﻿* Encoding: UTF-8.
RECODE partyid_2017 (1=1) (2=2) (3 thru 9=3) (98=3) (97=4) (99=4) (else=99) INTO pid1.
VARIABLE LABELS pid1 'Party ID without closers'.
VALUE LABELS pid1 (1)Conservative (2)Labour (3)Other party (4)No party (99)Missing.
EXECUTE. 
COMPUTE pid2=pid1.
EXECUTE.
RECODE rl2 (1=1) (2=2) (3 thru 8=3) (9 thru 10=4) INTO pid2.
VARIABLE LABELS pid2 'Party ID with closers'.
VALUE LABELS pid2 (1)Conservative (2)Labour (3)Other party (4)No party (99)Missing.
EXECUTE. 

RECODE rl3 (1=1) (2=2) (3 thru 4=3) (else=99) INTO eurefid1.
VARIABLE LABELS eurefid1 'EU ref ID without closers'.
VALUE LABELS eurefid1 (1)Leaver (2)Remainer (3)Neither (99)Missing.
EXECUTE. 
COMPUTE eurefid2=eurefid1.
EXECUTE.
RECODE rl4 (1=1) (2=2) (3 thru 4=3) INTO eurefid2.
VARIABLE LABELS eurefid2 'EU ref ID with closers'.
VALUE LABELS eurefid2 (1)Leaver (2)Remainer (3)Neither (99)Missing.
EXECUTE. 

RECODE rl5_1 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO bad1a.
VARIABLE LABELS bad1a 'Closed minded'.
VALUE LABELS bad1a (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 
RECODE rl5_3 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO bad1b.
VARIABLE LABELS bad1b 'Hypocritical'.
VALUE LABELS bad1b (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 
RECODE rl5_4 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO bad1c.
VARIABLE LABELS bad1c 'Selfish'.
VALUE LABELS bad1c (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 

RECODE rl5_2 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO good1a.
VARIABLE LABELS good1a 'Intelligent'.
VALUE LABELS good1a (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 
RECODE rl5_5 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO good1b.
VARIABLE LABELS good1b 'Honest'.
VALUE LABELS good1b (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 
RECODE rl5_6 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO good1c.
VARIABLE LABELS good1c 'Open minded'.
VALUE LABELS good1c (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 

RECODE rl6_1 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO bad2a.
VARIABLE LABELS bad2a 'Closed minded'.
VALUE LABELS bad2a (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 
RECODE rl6_3 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO bad2b.
VARIABLE LABELS bad2b 'Hypocritical'.
VALUE LABELS bad2b (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 
RECODE rl6_4 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO bad2c.
VARIABLE LABELS bad2c 'Selfish'.
VALUE LABELS bad2c (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 

RECODE rl6_2 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO good2a.
VARIABLE LABELS good2a 'Intelligent'.
VALUE LABELS good2a (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 
RECODE rl6_5 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO good2b.
VARIABLE LABELS good2b 'Honest'.
VALUE LABELS good2b (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 
RECODE rl6_6 (1=5) (2=4) (3=3) (4=2) (5=1) (else=99) INTO good2c.
VARIABLE LABELS good2c 'Open minded'.
VALUE LABELS good2c (1)Not at all well (2)Not well (3)Somewhat well (4)Moderately well (5)Very well (99)Missing.
EXECUTE. 

COMPUTE good1scale=99.
EXECUTE.
DO IF (good1a<99 & good1b<99 &good1c<99).
COMPUTE good1scale = (good1a+good1b+good1c)/3.
END IF.
EXECUTE.

COMPUTE good2scale=99.
EXECUTE.
DO IF (good2a<99 & good2b<99 &good2c<99).
COMPUTE good2scale = (good2a+good2b+good2c)/3.
END IF.
EXECUTE.

COMPUTE bad1scale=99.
EXECUTE.
DO IF (bad1a<99 & bad1b<99 &bad1c<99).
COMPUTE bad1scale = (bad1a+bad1b+bad1c)/3.
END IF.
EXECUTE.

COMPUTE bad2scale=99.
EXECUTE.
DO IF (bad2a<99 & bad2b<99 &bad2c<99).
COMPUTE bad2scale = (bad2a+bad2b+bad2c)/3.
END IF.
EXECUTE.


*TABLE 1 (NB needs to be combined with data from 'YouGov (Brexit ID) data'

WEIGHT BY Weight.
FREQUENCIES VARIABLES=eurefid1 pid1
  /ORDER=ANALYSIS.


*FIGURE 2 

MEANS TABLES=bad1a bad1b bad1c good1b good1c good1a bad2a bad2b bad2c good2b good2c good2a BY pid1
  /CELLS=MEAN COUNT STDDEV.


*TABLE 3

CROSSTABS
  /TABLES=pid1 BY rl8_1 rl8_2 rl7_1 rl7_2
  /FORMAT=AVALUE TABLES
  /CELLS=ROW 
  /COUNT ROUND CELL.